package com.jungle.bfi.service.biz.impl;

import com.github.dozermapper.core.Mapper;
import com.jungle.base.domain.bo.BaseUserBo;
import com.jungle.base.service.AbstractService;
import com.jungle.bfi.domain.bo.BizFactorBo;
import com.jungle.bfi.entity.BizFactorPo;
import com.jungle.bfi.service.biz.BizFactorService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.n3r.idworker.Sid;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class BizFactorServiceImpl extends AbstractService<BizFactorPo, BizFactorBo, String> implements BizFactorService {
    @Resource
    private Mapper mapper;

    @Override
    protected String getBoId(BizFactorBo bo) {
        return bo.getId();
    }

    @Override
    protected String newPoId() {
        return Sid.nextShort();
    }

    @Override
    protected void updatePo(BizFactorBo bo, BaseUserBo userBo, BizFactorPo po) {
        mapper.map(bo,po);
    }

    @Override
    protected BizFactorPo createPo(BizFactorBo bo, BaseUserBo userBo) {
        return mapper.map(bo, BizFactorPo.class);
    }
}
